const resourcePrefix = process.env.CMS_RESOURCE_PREFIX || 'tcb-ext-cms'

const ActivitySchema = {
  fields: [
    {
      description: '活动名称',
      displayName: '活动名',
      id: 'rvyvosiqb73plli67zcupa2o9nhr2dwi',
      isRequired: true,
      name: 'activityName',
      order: 0,
      type: 'String',
    },
    {
      defaultValue: true,
      description: '活动开启后，在指定的时间范围区间内可供跳转',
      displayName: '活动开启',
      id: 'l4ikt6y8wus4u9xt9zr3ww23m0o3qb72',
      isRequired: true,
      name: 'isActivityOpen',
      order: 1,
      type: 'Boolean',
    },
    {
      dateFormatType: 'timestamp-ms',
      description: '开始时间后，才允许跳转',
      displayName: '活动开始时间',
      id: 'fmpx6prjehenfvl0v0amzo58ckwf7kqb',
      isRequired: true,
      name: 'startTime',
      order: 2,
      type: 'DateTime',
    },
    {
      dateFormatType: 'timestamp-ms',
      description: '活动结束后，不允许跳转',
      displayName: '活动结束时间',
      id: 'dzapdx6alta68er1j4ptxnaoe6ols6fl',
      isRequired: true,
      name: 'endTime',
      order: 3,
      type: 'DateTime',
    },
    {
      description: '跳转中间页图片是否为长图',
      displayName: '是否长图',
      id: 'n70yz0jorghsx05vc9y1sha7ywhxhd9f',
      isRequired: false,
      name: 'isLongImg',
      order: 4,
      type: 'Boolean',
    },
    {
      description: '上传的图片将作为跳转中间页展示',
      displayName: '跳转中间页图片',
      id: 'n70yz0jorghsx05vc9y1sha7ywhxhd9f',
      isRequired: false,
      name: 'jumpImg',
      order: 5,
      resourceLinkType: 'https',
      type: 'Image',
    },
    {
      description: '上传的图片将作跳转按钮展示',
      displayName: '跳转按钮图片',
      id: 'n70yz0jorghsx05vc9y1sha7ywhxhd9f',
      isRequired: false,
      name: 'btnImg',
      order: 5,
      resourceLinkType: 'https',
      type: 'Image',
    },
    {
      description:
        '要跳转到的小程序的页面路径，如：/pages/index/index。请填写合法的路径，否则会导致无法跳转',
      displayName: '小程序页面路径',
      placeholder: '/pages/index/index',
      id: 'jfdtuq306rdh0k6bleuckmmvg0joig7p',
      name: 'appPath',
      order: 6,
      type: 'String',
    },
    {
      description: '通过 scheme 码进入小程序时的 query',
      displayName: '小程序页面 query',
      id: 'jfdtuq306rdh0k6bleuckmmvg0joig7p',
      name: 'appPathQuery',
      order: 7,
      type: 'String',
    },
    {
      description: '留空时会在服务端自动写入创建时间',
      displayName: '创建时间',
      id: 'Q9UyiUy9LT6C93Wqjrvai8LK78byZNCi',
      isHidden: false,
      name: '_createTime',
      order: 8,
      type: 'DateTime',
      isOrderField: true,
      orderDirection: 'desc',
    },
    {
      description: '留空时会在服务端自动写入更新时间',
      displayName: '更新时间',
      id: 'Q9UyiUy9LT6C93Wqjrvai8LK78byZNCi',
      isHidden: false,
      name: '_updateTime',
      order: 9,
      type: 'DateTime',
    },
  ],
  collectionName: `${resourcePrefix}-sms-activities`,
  displayName: '营销活动',
  _id: 'b45a21d55ff939720430e24e0f94cb12',
}

const TaskSchema = {
  fields: [
    {
      description: '短信内容，最长不超过 30 个字符',
      displayName: '短信内容',
      id: 'y0um9jhk9v9mrk424wbj95jleg2d2f8y',
      isRequired: true,
      max: 30,
      name: 'content',
      order: 0,
      type: 'String',
    },
    {
      displayName: '活动',
      description: '关联的活动',
      connectField: 'activityName',
      connectResource: 'b45a21d55ff939720430e24e0f94cb12',
      id: 'o91ouff816sbu0owdjqbcluira1enlqs',
      isRequired: true,
      name: 'activityId',
      order: 1,
      type: 'Connect',
    },
    {
      description: '以 , 号分割',
      displayName: '手机号码包',
      id: '70qq715n2ytm4dhp67to8j4xoou9kijt',
      isRequired: true,
      name: 'phoneNumberList',
      order: 2,
      type: 'MultiLineString',
    },
    {
      defaultValue: '',
      description: '发送状态',
      displayName: '发送状态',
      id: 'sp7adqpyejpwt86721plcvlk15ijnn6m',
      isHidden: false,
      isRequired: false,
      name: 'status',
      order: 3,
      type: 'string',
    },
    {
      defaultValue: 0,
      description: '电话号码数量',
      displayName: '发送用户数',
      id: 'tmaimgo7jtr9t3c7fiprvkl6knxb42ji',
      max: 1000,
      min: 0,
      name: 'total',
      order: 4,
      type: 'Number',
    },
    {
      dateFormatType: 'timestamp-ms',
      description: '创建时间',
      displayName: '创建时间',
      id: 'fmpx6prjehenfvl0v0amzo58ckwf7kqb',
      isRequired: true,
      name: 'createTime',
      order: 5,
      type: 'DateTime',
    },
  ],
  collectionName: `${resourcePrefix}-sms-tasks`,
  displayName: '发送短信',
  _id: '21ded5cb5ff93faa0456bdef6be2a7d6',
}

module.exports = {
  TaskSchema,
  ActivitySchema,
}
